<template>
	<custom-layout custom-class="custom-layout">

		<view class="cell-title">基本信息</view>
		<wd-cell-group border>
			
			<wd-cell title="装修类别" required>
				<view class="content">{{dictionaryStore.analysis('decoration_order_type',formData.decorationType)}}</view>
			</wd-cell>
			<wd-cell title="交房时间">
				<view class="content">{{formData.handoverTime&&dayjs(formData.handoverTime).format('YYYY-MM-DD HH:mm:ss')}}</view>
			</wd-cell>
			<wd-cell title="房屋类型" required>
				<view class="content">{{dictionaryStore.analysis('decoration_order_house_type',formData.houseType)}}</view>
			</wd-cell>
			<wd-cell title="归属城市" required>
				<view class="content">{{formData.adCode}}</view>
			</wd-cell>
			<wd-cell title="楼盘名称" required>
				<view class="content">{{propertyList.find(item=>item.id===formData.propertyName)?.name}}</view>
			</wd-cell>
							
		</wd-cell-group>
		<view class="cell-title">客户信息</view>
		<wd-cell-group border>
			<wd-cell title="客户名称" required>
				<view class="content">{{formData.name}}</view>
			</wd-cell>
			<wd-cell title="客户手机号" required>
				<view class="content">{{formData.phone}}</view>
			</wd-cell>
			<wd-cell title="客户微信">
				<view class="content">{{formData.wxCode}}</view>
			</wd-cell>
			<wd-cell title="详细地址">
				<view class="content">{{formData.address}}</view>
			</wd-cell>
			<wd-cell title="房屋面积" required>
				<view class="content">{{formData.houseArea}}</view>
			</wd-cell>
			<wd-cell title="性别">
				<view class="content">{{dictionaryStore.analysis('system_user_sex',formData.sex)}}</view>
			</wd-cell>
			
		</wd-cell-group>

		<!-- 返回 -->
		<wd-button block size="large" custom-class="submit-button" @click="handleSubmit">返回</wd-button>
		
	</custom-layout>
</template>

<script setup>
	import {
		reactive,
		ref
	} from 'vue';
	import {
		onLoad
	} from '@dcloudio/uni-app'
	import {
		useDictionaryStore,
		useUserStore
	} from '@/store/index.js'
	import city from '@/utils/city.js'
	import {
		createClue,
		getPropertyList
	} from '@/api/clue/create.js'
	import dayjs from 'dayjs'
	// 字典仓库
	const dictionaryStore = useDictionaryStore()
	// 用户仓库
	const userStore = useUserStore()
	// 楼盘列表
	const propertyList = ref([])
	// 获取楼盘列表
	const handleGetPropertyList = () => {
		const params = {
			pageSize: -1
		}
		getPropertyList(params).then((data) => {
			propertyList.value = data.list
		}).catch((error) => {
			uni.showToast({
				title: error,
				icon: 'error'
			})
		})
	}
	handleGetPropertyList()
	// 表单ref
	const formRef = ref()
	// 表单数据
	const formData = ref({})
	// 处理返回
	const handleSubmit = async () => {
		uni.navigateBack()
	}
	
	

	onLoad((option)=>{
		formData.value = JSON.parse(decodeURIComponent(option.item))
		
	})
</script>

<style lang="scss" scoped>
	// 自定义布局
	:deep(.custom-layout) {
		background: #F8F8F8;
	}

	// 返回按钮
	:deep(.submit-button) {
		margin: 32rpx;
	}
	.cell-title {
		font-size: 30rpx;
		font-weight: bold;
		margin: 24rpx;
		padding-left: 10rpx;
		position: relative;
	}
	.cell-title:before {
		content: "";
		position: absolute;
		left: -2px;
		top: 15%;
		height: 70%;
		width: 6rpx;
		background-color: #6a9cff;
	}
	
			
</style>